public class ClimbStairs {
    public int climbStairs(int n) {
        int dp[] = new int[n + 1];
        if (n == 0) return 0;
        if (n == 1) return 1;
        if (n == 2) return 2;
        int pre= 1;
        int cur = 2;
        for (int i = 3; i < n + 1; i++) {
            int temp=cur;
            cur = cur + pre;
            pre=temp;
        }
        return cur;

    }
}
